# from flask import request
# from flask_login import login_user
#
# from application.models.model import BrokerUser
# from swaager_init import siwa
# from tools.broker_api import get_token_by_code
# from tools.data_tools import ret_route
#
# callback = siwa.blueprint("callback", __name__)
#
#
# @callback.route("/<any7(github,gitee):broker>", methods=['get'])
# def github_cb(broker):
#     code = request.args.get('code')
#     token, uid = get_token_by_code(broker, code)
#
#     broker_user = BrokerUser.query.filter_by(broker_uid=uid, broker_name=broker).first()
#
#     if broker_user and broker_user.user:
#         login_user(broker_user.user)
#         return ret_route(2000)
#
#     return ret_route(2000, data={'broker_id': uid, 'token': token, 'broker': broker})

























